﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Magenic.CodeMastery.SharePoint.PMO;
using System.Collections.Generic;

namespace Magenic.CodeMastery.SharePoint.PMO
{
    public partial class GanttControl : System.Web.UI.UserControl, GanttView
    {
        #region Private Fields

        private GanttPresenter presenter;

        #endregion

        #region Constructors

        public GanttControl()
        {
            this.presenter = new GanttPresenter(this);        
        }

        #endregion

        #region Public Methods

        public void LoadProjects(int year)
        {
            this.presenter.LoadGanttChart(year);
        }

        public string RenderGanttItem(object project)
        {
            return string.Empty;
        }

        #endregion

        #region GanttView Members

        public IEnumerable<GanttBox> Months
        {
            get
            {
                return this.repMonths.DataSource as IEnumerable<GanttBox>;
            }
            set
            {
                this.repMonths.DataSource = value;
            }
        }

        public IEnumerable<GanttBox> Days
        {
            get
            {
                return this.repDays.DataSource as IEnumerable<GanttBox>;
            }
            set
            {
                repDays.DataSource = value;
            }
        }

        public IEnumerable<GanttBox> Activities
        {
            get
            {
                return this.repActivities.DataSource as IEnumerable<GanttBox>;
            }
            set
            {
                this.repActivities.DataSource = value;
            }
        }

        #endregion
    }
}